package com.em.sugarfight.service.impl;

import com.em.sugarfight.entity.*;
import com.em.sugarfight.service.OperateService;
import com.em.sugarfight.service.engine.CombinedStrategyEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateServiceImpl implements OperateService {

    @Autowired
    CombinedStrategyEngine strategyEngine;

    @Override
    public MoveCommand analysAndOperate(GameState gameState) {

//        Cell[][] map = gameState.getMap();
//        List<MapItem> mapItems = gameState.getMap_items();
//        PlayerStateVo myPlayer = gameState.getMy_player();
//        List<PlayerStateVo> otherPlayers = gameState.getOther_players();
//
//
//        int Position = (int)(Math.random() * 4);
//        String direction;
//        switch ( Position){
//            case 0: direction = "U"; break;
//            case 1: direction = "D"; break;
//            case 2: direction = "L"; break;
//            case 3: direction = "R"; break;
//            default: direction = "N";
//        }
//
//        return new MoveCommand(direction,true,50);
        return strategyEngine.makeDecision(gameState);
    }
}
